// client
if SERVER then return end
print( "\n####################################################" )
print( " Frosting Is On The Cake." )
print( "####################################################\n" )

surface.CreateFont( "verdana", 26, 700, true, false, "noticeFont", true )
--local imoutofhere = 0
local snowground = 0.5
local extracounter = 0
local splashcolor = 0
local alright = 0
local splash = surface.GetTextureID("Frosting")
local Crzyishere = 0
local Sniperishere = 0
local Cakeishere = 0

local function Frostingsplashintro()
	surface.SetTexture(splash)
	surface.SetDrawColor(255,255,255,splashcolor)
	surface.DrawTexturedRect(ScrW()*0.5-218,ScrH()*0.5-70,436,140)
end
hook.Add("HUDPaint","FrostingSplash",Frostingsplashintro)

local splashcolor2 = 0
local splash2 = surface.GetTextureID("CreditsF")

local function Frostingsplashintro2()

/*
	if imoutofhere == 1 then
		draw.SimpleText( "CRASHING YOU LOL GTFO", "noticeFont", ScrW() * 0.5, ScrH() * 0.4, Color( 255, 10, 10, 255 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_TOP )
	end
*/

	if Crzyishere == 1 then
		draw.SimpleText( "Crzy has joined the server", "noticeFont", ScrW() * 0.5, ScrH() * 0.4, Color( 100, 255, 100, 255 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_TOP )
	end

	if Sniperishere == 1 then
		draw.SimpleText( "Sniper has joined the server", "noticeFont", ScrW() * 0.5, ScrH() * 0.4, Color( 100, 255, 100, 255 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_TOP )
	end

	if Cakeishere == 1 then
		draw.SimpleText( "Cake has joined the server", "noticeFont", ScrW() * 0.5, ScrH() * 0.4, Color( 100, 255, 100, 255 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_TOP )
	end

	surface.SetTexture(splash2)
	surface.SetDrawColor(255,255,255,splashcolor2)
	surface.DrawTexturedRect(ScrW()*0.5-208,ScrH()*0.5-80,416,160)

end
hook.Add("HUDPaint","FrostingSplash2",Frostingsplashintro2)


function ArghItBurns()
	DrawBloom( snowground, 
		5.481000,
		0.000000,
		4.567000,
		1,
		0.000000,
		240/255,
		240/255,
		240/255
	)
end
hook.Add( "RenderScreenspaceEffects", "theresnow", ArghItBurns )


timer.Create( "splashcounter", 0.04, 0, function()
	if alright == 0 then
		if splashcolor <= 245 then
			splashcolor = splashcolor + 5
		else
			alright = 1
		end
	elseif alright == 1 then
		if splashcolor >= 5 then
			splashcolor = splashcolor - 5
		else
			alright = 2
		end
		elseif alright == 2 then 
		if splashcolor2 <= 245 then
			splashcolor2 = splashcolor2 + 5
		else
			alright = 3
		end
	elseif alright == 3 then
		if splashcolor2 >= 2 then
			splashcolor2 = splashcolor2 - 2
		else
			alright = 4
		end
	elseif alright == 4 then
		if extracounter < 100 then
		extracounter = extracounter + 1 
		snowground= snowground + .005
		else
		alright = 5
		end
	else
		splashcolor = 0
		splashcolor2 = 0
		timer.Remove("splashcounter")
		timer.Destroy("Snowtimer")
		timer.Destroy("Snowtimer2")
	end
end )

function snow()

	Ammount=100

	local Snowspawner = ParticleEmitter(Vector(0,0,200))
	timer.Create("Snowtimer", 0.1, 0, function()
		for i=1, Ammount do
--			local SnowItSelf = Snowspawner:Add("particle/snow",LocalPlayer():GetPos() + Vector(math.random(-200,200),math.random(-200,200),math.random(450,550)) )

			local SnowItSelf = Snowspawner:Add("particle/snow",Vector(math.random(-5000,5000),math.random(-5000,5000),521) )
			SnowItSelf:SetVelocity(Vector(math.random(-500,500),math.random(-500,500),math.random(-300,-100)))
			SnowItSelf:SetDieTime(7)
			SnowItSelf:SetCollide(true)
			SnowItSelf:SetStartAlpha(255)
			SnowItSelf:SetEndAlpha(0)
			SnowItSelf:SetStartSize(math.random(1,5))
			SnowItSelf:SetEndSize(math.random(0,1))
			SnowItSelf:SetColor(math.random(240,255),math.random(240,255),math.random(240,255))
			SnowItSelf:SetRoll(math.random(0,360))
		end
	end )
	Snowspawner:Finish()


	local Smallsnowspawner = ParticleEmitter(Vector(0,0,200))
	timer.Create("Snowtimer2", 0.1, 0, function()
		for i=1, Ammount do
--			local smallSnowItSelf = Smallsnowspawner:Add("particle/snow",LocalPlayer():GetPos() + Vector(0,0,math.random(450,550)) )

			local smallSnowItSelf = Smallsnowspawner:Add("particle/snow",Vector(math.random(-5000,5000),math.random(-5000,5000),521) )
			smallSnowItSelf:SetVelocity(Vector(math.random(-700,700),math.random(-700,700),math.random(-400,-200)))
			smallSnowItSelf:SetDieTime(4)
			smallSnowItSelf:SetCollide(true)
			smallSnowItSelf:SetStartAlpha(255)
			smallSnowItSelf:SetEndAlpha(0)
			smallSnowItSelf:SetStartSize(math.random(1,3))
			smallSnowItSelf:SetEndSize(math.random(0,.1))
			smallSnowItSelf:SetColor(math.random(240,255),math.random(240,255),math.random(240,255))
			smallSnowItSelf:SetRoll(math.random(0,360))
		end
	end )
	Smallsnowspawner:Finish()

end
snow()

function sunday()
	timer.Destroy("Snowtimer")
	timer.Destroy("Snowtimer2")
end

/*
function gocrashaboutit( um )
	imoutofhere = 1
	timer.Create( "my_timer", 5, 1, function()
	print( " im not as cool as i think i am " ..os.date("%R") .. "\n")
	end)
end
usermessage.Hook( "gocrashaboutit", gocrashaboutit )
*/

function adminIntro( um )
	Whoshere = um:ReadString()
	print(Whoshere)

	if Whoshere == "STEAM_0:0:15720779" then

		Crzyishere = 1
		timer.Create( "crzyintro", 6, 1, function()
			Crzyishere = 0
		end )
		local Titlesound = CreateSound( LocalPlayer(), "Intros/Crzy.mp3" );
		Titlesound:Play();

	elseif Whoshere == "STEAM_0:1:1677663" then

		Sniperishere = 1
		timer.Create( "sniperintro", 6, 1, function()
			Sniperishere = 0
		end )
		local Titlesound = CreateSound( LocalPlayer(), "Intros/SniperN.mp3" );
		Titlesound:Play();

	elseif Whoshere == "STEAM_0:0:14543368" then

		Cakeishere = 1
		timer.Create( "cakeintro", 6, 1, function()
			Cakeishere = 0
		end )
		local Titlesound = CreateSound( LocalPlayer(), "Intros/Cake.mp3" );
		Titlesound:Play();

	end

end
usermessage.Hook( "adminishereilintrohimforyou", adminIntro )
